package engine.newUi
{
	import com.greensock.TweenLite;
	
	import engine.GameData;
	import engine.control.loading.MultLoader;
	import engine.data.BindManage;
	import engine.data.ModelLocator;
	import engine.data.ResPath;
	import engine.display.EscortPlay;
	import engine.display.newAttack.vo.EscortPlayVo;
	import engine.event.SceneEvent;
	import engine.event.SoundEvent;
	import engine.flag.GameDefine;
	import engine.logic.LogSendLogic;
	import engine.logic.login.PlayCDTimerLogic;
	import engine.net.datatype.WString;
	import engine.net.event.CustomMsgEvent;
	import engine.net.messages.CustomToClientFlag;
	import engine.net.messages.CustomToServerFlag;
	import engine.net.mgr.SystemSender;
	import engine.tip.TipsMainLogic;
	import engine.ui.AlertUI;
	import engine.ui.MainUIManager;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.filters.GlowFilter;
	import flash.ui.Mouse;
	import flash.utils.Timer;
	
	import newx.StageInfo;
	import newx.com.ResManager;
	import newx.com.config.StaticIni;
	import newx.utils.DateFormatter;
	import newx.utils.FilterUtil;

	public class EscortSceneLogic
	{
		private static var _self			:EscortSceneLogic;
		private var _myDis					:EscortSceneUI;
		private var _model					:ModelLocator;
		private var _bindManage			:BindManage;
		private var _playArray				:Array;
		private var _disListArray			:Array	=	[];
		
		private var _heroTimer				:Timer;
		private var _time					:Timer;
		private var _reftime				:Timer;
		private var _activeTimer			:Timer;
		
		private var _overTimer				:int;
		private var _activeOverTimer		:int;
		private var _pkInfoArray			:Array  = []   ; 
//		private var _imageYArray			:Array		=	[290,320,350,380,410,440,470]
		private var _imageYArray			:Array		=	[210,240,270,300,330,360,390,420]
		private var _isHaveMe				:Boolean	=	false;
		private var _isNumOver				:Boolean	=	false;
		private var _checkPlayObj			:Object		=	{};
		private var _convoyObj				:Object		=	null
		private var _vipLevel				:int		=	0;
		private var _playerConvoyCallCount	:int		=	0
		private var _moveTime				:int		=	0;
		private var _magicCoin				:int		=	0;
		private var _goldCoin				:int		=	0;
		private var _isBind				:Boolean	=	false;
		private var _col					:int		=	0;
		private var _addHeroName			:String		=	"";
		private var _addRoRemove			:int		=	-1;
		private var _heroIsWork			:Boolean	=	false;
		private var _colorGreed			:uint		=	0x00FF00;
		private var _colorRed				:uint		=	0xFF0000
		private var _isCanPK				:Boolean	=	false;
		private var _isCDTimer				:Boolean	=	false;
		private var _pic					:MovieClip 	= new MovieClip();
		private var _playerOverTime		:int;
		private var _playercishu			:int;
		private var _playerGold			:int;
		private var _playerRepute			:int;
		private var _coveryActive			:int		=	-1;
		private var _springFestival		:Boolean	= false;
		public function EscortSceneLogic()
		{
			init()
		}
		public static function getInstance():EscortSceneLogic
		{
			if(_self == null)
			{
				_self	=	new EscortSceneLogic();
			}
			return _self;
		}
		/**
		 * 添加事件 
		 */		
		public function addListener():void
		{
			_pic      		= ResManager.newResClass("CustomControl_025") as MovieClip;
			_pic.visible    = false;
			
//			_myDis.backMc.source		=	ResPath.SWF + "escortScene.swf";
			_myDis.escortBtn	.addEventListener(MouseEvent.CLICK, btnClickHandle);
			_myDis.closeBtn		.addEventListener(MouseEvent.CLICK, btnClickHandle);
			_myDis.heroBtn		.addEventListener(MouseEvent.CLICK, btnClickHandle);
			_myDis.OverBtn		.addEventListener(MouseEvent.CLICK, btnClickHandle);
			_myDis.addTime		.addEventListener(MouseEvent.CLICK, btnClickHandle);
			
//			_time				.addEventListener(TimerEvent.TIMER, timerHandle);
			_reftime			.addEventListener(TimerEvent.TIMER, reftimerHandle);
//			_heroTimer			.addEventListener(TimerEvent.TIMER,	heroTimerHandle);
			
			_myDis.heroBtn		.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.OverBtn		.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.addTime		.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.logoPic		.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.activePic	.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.springFestivalPic.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			
			_myDis.heroBtn		.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.OverBtn		.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.addTime		.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.logoPic		.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.activePic	.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.springFestivalPic.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			
			_myDis.moneyText_1.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.moneyText_2.addEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.moneyText_1.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.moneyText_2.addEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			if(!_isBind)
			{
				_bindManage.BindProp(_model.scene.Role,"MagicCoin",this,"magicCoin");
				_bindManage.BindProp(_model.scene.Role,"GoldCoin",this,"goldCoin");
				_bindManage.BindProp(_model.scene.Role,"VIPLevel",this,"vipLevel");
				_bindManage.BindProp(_model.scene.Role,"PlayerConvoyCallCount",this,"playerConvoyCallCount");
				PlayCDTimerLogic.getInstance().resgis(7,pkCDTime);
				_isBind	=	true
			}
		}
		/**
		 * 移除事件
		 */		
		public function removeListener():void
		{
			if(_pic.visible){
				Mouse.show();
				_pic.visible = false;
				_pic.stop();
				StageInfo.stage.removeChild(_pic);
				_pic = null;
				TipsMainLogic.instance.hide();
			}
			
			_addRoRemove	= -1;
			_springFestival = false;
			_myDis.springFestivalPic.visible	= false;
			_myDis.springFestivalLab.visible	= false;
			
			clearPlay();
			_myDis.escortBtn	.removeEventListener(MouseEvent.CLICK, 	btnClickHandle);
			_myDis.closeBtn		.removeEventListener(MouseEvent.CLICK,	btnClickHandle);
			_myDis.heroBtn		.removeEventListener(MouseEvent.CLICK, 	btnClickHandle);
			_myDis.OverBtn		.removeEventListener(MouseEvent.CLICK, 	btnClickHandle);
			_time				.removeEventListener(TimerEvent.TIMER,	timerHandle);
			_reftime			.removeEventListener(TimerEvent.TIMER, reftimerHandle);
			if(_heroTimer){
				_heroTimer			.removeEventListener(TimerEvent.TIMER,	heroTimerHandle);	
			}
			
			_myDis.heroBtn		.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.OverBtn		.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.addTime		.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.logoPic		.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.activePic	.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.springFestivalPic.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			
			_myDis.heroBtn		.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle)
			_myDis.OverBtn		.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.addTime		.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.logoPic		.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.activePic	.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.springFestivalPic.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			
			_myDis.moneyText_1.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.moneyText_2.removeEventListener(MouseEvent.MOUSE_OVER, btnOverHandle);
			_myDis.moneyText_1.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
			_myDis.moneyText_2.removeEventListener(MouseEvent.MOUSE_OUT, btnOutHandle);
				
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_CONVOY_CLOSE_UI)
			_myDis.created		=	false;
			MainUIManager.getInstance().intoScene();
			
		}
		/**
		 * VIP等级 
		 * @param val
		 * 
		 */		
		public function set vipLevel(val:int):void
		{
			_vipLevel	=	val;
			//GodOfWarVIPLevel召唤关羽VIP等级
			if(_vipLevel >= _convoyObj["GodOfWarVIPLevel"])
			{
				_myDis.heroBtn.visible	=	true;
			}
			else
			{
				_myDis.heroBtn.visible	=	false;
			}
			setEscortEnable(_isHaveMe,_isNumOver);
		}
		/**
		 * 召换次数 
		 * @param val
		 * 
		 */		
		public function set playerConvoyCallCount(val:int):void
		{
			_playerConvoyCallCount	=	val;
			if(_playerConvoyCallCount >= _convoyObj["SummonVIPLevel"])
			{
//				_myDis.heroBtn.mouseEnabled	=	false;
//				_myDis.heroBtn.filters	=	[FilterUtil.GrayColorFilter];
				_myDis.heroBtn.enabled	=	false
			}
			else
			{
				if(_heroIsWork)
				{
//					_myDis.heroBtn.mouseEnabled	=	false;
//					_myDis.heroBtn.filters	=	[FilterUtil.GrayColorFilter];
					_myDis.heroBtn.enabled	=	false
				}
				else
				{
//					_myDis.heroBtn.mouseEnabled	=	true;
//					_myDis.heroBtn.filters	=	null
					_myDis.heroBtn.enabled	=	true;
				}

			}
		}
		/**
		 * 元宝 
		 * @param val
		 * 
		 */		
		public function set magicCoin(val:int):void
		{
			_magicCoin = val;
			if(val > 10000){
				_myDis.moneyText_1.htmlStrByBorder	=	Math.floor(val / 10000) + StaticIni.getSwfLangStr("UIString_1000629");
			} else {
				_myDis.moneyText_1.htmlStrByBorder	=	String(val);
			}
		}
		/**
		 * 铜币 
		 * @param val
		 * 
		 */		
		public function set goldCoin(val:int):void
		{
			_goldCoin = val;
			if(val > 10000){
				_myDis.moneyText_2.htmlStrByBorder	=	Math.floor(val / 10000) + StaticIni.getSwfLangStr("UIString_1000629");
			} else {
				_myDis.moneyText_2.htmlStrByBorder	=	String(val);
			}
		}
		
		/**
		 * 拦截CD时间 
		 * @param val
		 * 
		 */		
		public function pkCDTime(val:int,col:int):void
		{
			_col		=	col;
			if(val <= 0)
			{
				_isCDTimer					=	false;
				_myDis.nextPkTime.visible	=	false;
				_myDis.addTime.visible		=	false;
				_myDis.info_1.visible		=	true;
			}
			else
			{
				_isCDTimer					=	true;
				_myDis.nextPkTime.visible	=	true;
				_myDis.addTime.visible		=	true;
				_myDis.nextPkTime.htmlStrByBorder	=	StaticIni.getSwfLangStr("UIString_1000526") + PlayCDTimerLogic.getInstance().getTimerStr(val);
				_myDis.info_1.visible		=	false;
			}
		}
		/**
		 * 坐标处理
		 */		
		public function changeLocation():void
		{
//			_myDis.x	=	 (SceneChangeManager.getGameWidth() - _myDis.width) * .5
//			_myDis.y	=	 (SceneChangeManager.getGameHeight() - _myDis.height) * .5
		}
		/**
		 * 初始化 
		 */		
		private function init():void
		{
			_model						=	ModelLocator.getInstance();
			_bindManage					=	BindManage.getInstance();
			_myDis						=	EscortSceneUI.getInstance();
			_time						=	new Timer(1000);
			_reftime					=	new Timer(180000);
//			_heroTimer					=	new Timer(60000);
			_myDis.OverBtn.visible		=	false;
			_myDis.logoPic.visible		=	false;
			_myDis.leftTimeLabel.visible =  false;
			_myDis.activePic.visible 	=	false;
			_myDis.activeLeftTime.visible = false;
			
			_myDis.addTime.visible		=	false;
			_myDis.nextPkTime.visible	=	false;
			_myDis.overTime.visible		=	false;
			_myDis.nextPkTime.visible	=	false;
			
			_springFestival = false;
			_myDis.springFestivalPic.visible	= false;
			_myDis.springFestivalLab.visible	= false;
			
//			_myDis.pkinfoBack.mouseChildren = _myDis.pkinfoBack.mouseEnabled = false;
//			_myDis.pkinfoTxt.mouseChildren  = _myDis.pkinfoTxt.mouseEnabled	 = false;
			
			_myDis.palySpace.removeChildAt(0);
			
			_convoyObj					=	StaticIni.getIniObj("ConvoyPrize");
		
			_model.addEventListener(String(CustomToClientFlag.SERVER_CUSTOMMSG_CONVOY_MSG),openEscorotList);
			_model.addEventListener(String(CustomToClientFlag.SERVER_CUSTOMMSG_SERVER_TIME), refreshOverTime);
			_model.addEventListener( SceneEvent.SceneLoaded, onSceneLoaded );
		}
	
		private function onSceneLoaded( evt : SceneEvent ):void
		{
			_model.removeEventListener( SceneEvent.SceneLoaded, onSceneLoaded );
			
//			_myDis.backMc.source		=	ResPath.SWF + "escortScene.swf";
		}
		/**
		 * 打开押镖列表界面
		 * @param e
		 * 
		 */		
		private function openEscorotList(e:CustomMsgEvent):void
		{
			var playList:Array	=	e.pList;
			var infoType:int	=	playList[0];
//			_addRoRemove = -1;
			switch(infoType)
			{
				// 邀请玩家帮助护送
				case 1:
					requestHelp(playList);
					break;
				// 同意帮助玩家护送
				case 2:
					sureHelp(playList);
					break;
				// 所有在护送的玩家
				case 3:
					_time.stop();
					readPlayList(playList);
					break;
				// 玩家自己在护送
				case 4:
					readPlayInfo(playList);
					showEscortUI();
					break;
				// 战神召唤剩余时间
				case 5:
					heroHelpInfo(playList);
					break;
				// 拦截信息
				case 6:
					readPkInfo(playList);
					break;
				// 召唤战神的玩家名
				case 7:
					whoHero(playList);
					break;
				// 取消邀请玩家护送
				case 8:
					removeHelp(playList);
					break;
				//邀请发出去了// 邀请玩家帮助护送成功
				case 9:
					EscortLogic.getInstance().setHelp();
					break;
				//邀请没发出去,// 邀请玩家帮助护送失败
				case 10:
					EscortLogic.getInstance().getOut(false);
					break;
				// 邀请玩家帮助护送,玩家超时
				case 11:
					EscortLogic.getInstance().getOutTime();
					break ;
				// 玩家劫镖战斗结束
				case 12:
					readPlayInfo(playList);
					showEscortUI();
					break;
				//更新自己结束时间
				case 13:
					checkStage(playList);
					break;
				//添加单个刚进来的押镖玩家
				case 14:
					addPlayToPlayList(playList);
					break;
				//押镖活动信息
				case 15:
					dealActiveInfo(playList);
					break;
				//春节活动
				case 16:
					dealSpringFestival(playList);
					break;
					
			}
			_reftime.start();
		}
		private function showEscortUI():void
		{
			if(!_myDis.created)
			{
				
				if(!MultLoader.getInstance().getSourceByUrl(ResPath.SWF + "escortScene.swf"))
				{
					MultLoader.getInstance().load([ResPath.SWF + "escortScene.swf"],true ,createImage);
				}else
				{
					createImage();
				}
			}
		}
		private function createImage():void
		{
			if(GameData.SceneType	!=	GameDefine.SceneType_Normal)
			{
				return;
			}
			MainUIManager.getInstance().intoScene(GameDefine.SceneType_EscortScene);
			EscortSceneUI.getInstance().backMc.source		=	MultLoader.getInstance().getSourceByUrl(ResPath.SWF + "escortScene.swf");
			_myDis.created		=	true;
		}
		/**
		 * 更新自己结束时间
		 * 
		 */
		private function checkStage(val:Array):void
		{
			_playerOverTime = val[0];
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_SERVER_TIME);
		}
		
		/**
		 * 获取服务器时间
		 */
		private function refreshOverTime(e:CustomMsgEvent):void
		{
			var playList:Array	=	e.pList;
			var serverTime:int	=	playList[0];
			var _overtime:int	=	_playerOverTime - serverTime;
			if(_overtime == 0){
				_myDis.OverBtn.visible = false;
				_myDis.info_2.visible = true;
				_myDis.info_2.htmlStrByBorder	=	StaticIni.getSwfLangStrVar("EscortStr_13",[_playercishu]);
				_myDis.overTime.visible = false;
			}
		}
		
		/**
		 * 请求帮助 
		 * @param val
		 * 
		 */		
		private function requestHelp(val:Array):void
		{
			var playName:String	=	val[1];
			
			AlertUI.showAlert("",
							StaticIni.getSwfLangStrVar("EscortStr_29",[val[1],StaticIni.getSwfLangStr("EscortName_0" + val[2])]),
							AlertUI.YES|AlertUI.NO,requestHelpHandle,[playName]);
		}
		/**
		 * 确认帮助 
		 * @param val
		 * 
		 */		
		private function sureHelp(val:Array):void
		{
			var playName:String	=	val[1];
//			AlertUI.showAlert("",playName + StaticIni.getSwfLangStr("UIString_1000527"),AlertUI.YES);
			EscortLogic.getInstance().helpOK();
		}
		
		/**
		 *添加或者删除单个开始或者已完成的玩家 
		 * @param val
		 * 
		 */
		private function addPlayToPlayList(val:Array):void
		{
			//先判断有无相同人名 有就删除。
			for(var i:int;i<_disListArray.length;i++)
			{
				var removeMC : MovieClip;
				var currentPlay:EscortPlayVo;
				removeMC = _disListArray[i] as MovieClip;
				currentPlay = removeMC["data"];
				if(currentPlay.name == val[2])
				{
					if(_model.scene.Role.getPlayerName() == currentPlay.name)
					{
						_isHaveMe = false;
						setEscortEnable(_isHaveMe,_isNumOver);
					}
					_disListArray.splice(i,1);
					_myDis.palySpace.removeChild(removeMC);
					removeMC.removeEventListener(MouseEvent.CLICK, 		listPicClickHandle);
					removeMC.removeEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
					removeMC.removeEventListener(MouseEvent.MOUSE_MOVE,	listPicMoveHandle);
					removeMC.removeEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
					removeMC = null;
					break;
				}
			}
			if(val[1] == 1)//添加
			{
				var itemPlay:EscortPlayVo	= 	new EscortPlayVo();
				itemPlay.name				=	val[2];
				itemPlay.level				=	val[3];
				itemPlay.clanName			=	val[4];
				itemPlay.escortType			=	val[5];
				itemPlay.index				=	val[6];
				itemPlay.timeMax			=	val[7];
				itemPlay.overTime			=	val[8];
				itemPlay.helpName			=	val[9];
				itemPlay.escortMoney		=	val[10];
				itemPlay.reputation			=	val[11];
				var PicBox:MovieClip;
				var playItem:EscortPlay;
				PicBox		=	new MovieClip();
				playItem	=	new EscortPlay();
				playItem.url				=	ResPath.SWF	+ "movemoneycar_" + itemPlay.escortType + ".swf";
				playItem.scaleX				=	playItem.scaleY	=	.5
				playItem.x					=	playItem.y	=	0
				PicBox["playItem"] = playItem;
				PicBox.addChild(playItem);
				
				PicBox.addEventListener(MouseEvent.CLICK, 		listPicClickHandle);
				PicBox.addEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
				PicBox.addEventListener(MouseEvent.MOUSE_MOVE,	listPicMoveHandle);
				PicBox.addEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
				PicBox.y					=	_imageYArray[int(Math.random()*8)];
				PicBox.x					=	50 + ((1200-70) -(1200 -70)* (itemPlay.overTime / itemPlay.timeMax));
				PicBox["data"]				=	itemPlay;
				PicBox["speed"]			=	(1200-70) / itemPlay.timeMax;
				PicBox["hero"]				=	0;
				
				if(_model.scene.Role.getPlayerName() == itemPlay.name)
				{
					PicBox["hero"]				=	1;
					PicBox.filters	=	[new GlowFilter(_colorGreed, .7, 10, 10 )];
					_moveTime	=	itemPlay.overTime;
					_isHaveMe	=	true;
					_time.stop();
					_time.removeEventListener(TimerEvent.TIMER, timerHandle);
					_time.addEventListener(TimerEvent.TIMER, timerHandle);
					_time.start();
				}
				_myDis.palySpace.addChild(PicBox);
				_disListArray.push(PicBox);
				
				setEscortEnable(_isHaveMe,_isNumOver);
				checkHeroFilt(_addHeroName,_addRoRemove);
				
			}
			
		}
		
		/**
		 * 解析运镖队伍 
		 * @param val
		 * 
		 */		
		private function readPlayList(val:Array):void
		{
			_isHaveMe		=	false;
			_playArray		=	[];
			_checkPlayObj	=	[];
			for(var i:int = 1; i < val.length; i+= 10)
			{
				var itemPlay:EscortPlayVo	= 	new EscortPlayVo();
				itemPlay.name				=	val[i];
				itemPlay.level				=	val[i + 1];
				itemPlay.clanName			=	val[i + 2];
				itemPlay.escortType			=	val[i + 3];
				itemPlay.index				=	val[i + 4];
				itemPlay.timeMax			=	val[i + 5];
				itemPlay.overTime			=	val[i + 6];
				itemPlay.helpName			=	val[i + 7];
				itemPlay.escortMoney		=	val[i + 8];
				itemPlay.reputation			=	val[i + 9];
				if(itemPlay.overTime >0)
				{
					_playArray.push(itemPlay);
//					_checkPlayObj[itemPlay.name]	=	itemPlay;
					if(itemPlay.name ==	_model.scene.Role.getPlayerName())
					{
						_moveTime	=	itemPlay.overTime;
						_isHaveMe	=	true;
					}
				}
			}
//			for(var itemStr:String	in _checkPlayObj)
//			{
//				_playArray.push(_checkPlayObj[itemStr]);
//			}
			setEscortEnable(_isHaveMe,_isNumOver);
			addPlayList(_playArray);
			checkHeroFilt(_addHeroName,_addRoRemove);
		}
		/**
		 * 当前玩家的信息
		 */		
		private function readPlayInfo(val:Array):void
		{
			_myDis.info_1.htmlStrByBorder	=	StaticIni.getSwfLangStrVar("EscortStr_12",[_convoyObj["pkNum"]-val[1]]);
			_myDis.info_2.htmlStrByBorder	=	StaticIni.getSwfLangStrVar("EscortStr_13",[_convoyObj["maxNum"]-val[2]]);
			_playercishu					=	_convoyObj["maxNum"]-val[2];
			_myDis.info_3.htmlStrByBorder	=	StaticIni.getSwfLangStrVar("EscortStr_14",[_convoyObj["helpNum"]-val[3]]);
			_isNumOver						=	val[2]<int(_convoyObj["maxNum"])?false:true;
			_isCanPK						=	val[1]<int(_convoyObj["pkNum"])?true:false;
			_playerGold						=	val[4];
			_playerRepute					=	val[5];
			setEscortEnable(_isHaveMe,_isNumOver);
			
		}
		/**
		 * 英雄被召唤了
		 * @param val
		 * 
		 */		
		private function heroHelpInfo(val:Array):void
		{
			if(_heroTimer){
				_heroTimer.stop();
				_heroTimer.removeEventListener(TimerEvent.TIMER,	heroTimerHandle);
			}
			
			_heroIsWork	=	true;
			_overTimer	=	val[1];// / 60;
			_heroTimer	=	new Timer(1000, _overTimer);
			_heroTimer.addEventListener(TimerEvent.TIMER,	heroTimerHandle);
			_heroTimer.start();
			heroTimerHandle(null)
			
		}
		/**
		 * 解析PK信息 
		 * @param val
		 * 
		 */		
		private function readPkInfo(val:Array):void
		{
			_pkInfoArray	=	[];
			var str:String	=	"";
			for(var i:int = 1; i < val.length; i+= 5)
			{
				str	=	StaticIni.getSwfLangStrVar("EscortStr_27",[val[i],val[i+1],StaticIni.getSwfLangStr("EscortName_0" + val[i+2]),val[i+3],val[i+4]]);
				_pkInfoArray.unshift(str);
			}
			_myDis.pkinfoTxt.htmlText	=	_pkInfoArray.join("<br>");
		}
		/**
		 * 哪位大侠招战神了 
		 * @param val
		 * 
		 */		
		private function whoHero(val:Array):void
		{
			_addRoRemove	=	val[1];
			_addHeroName	=	val[2];
			checkHeroFilt(_addHeroName,_addRoRemove);
		}
		/**
		 * 不需要你帮助了，滚蛋吧你！ 
		 * @param val
		 * 
		 */		
		private function removeHelp(val:Array):void
		{
			AlertUI.showAlert("",val[1] + StaticIni.getSwfLangStr("UIString_1000528"), AlertUI.OK);
		}
		
		/**
		 * 检索是否存在
		 */
		private function checkArr(str:String):Boolean
		{
			var _tempArr:Array = new Array;
			if(_disListArray.length > 0){
				for(var i:int = 0; i < _disListArray.length; i++){
					_tempArr.push((_disListArray[i] as MovieClip)["data"].name);
				}
				if(_tempArr.indexOf(str) == -1){
					return false;
				} else {
					return true;
				}
			}
			return false;
		}
		
		/**
		 * 添加护送队伍列表
		 */		
		private function addPlayList(val:Array):void
		{
			clearPlay();
			for(var i:int = 0; i < val.length; i++)
			{
				var playVo:EscortPlayVo		=	val[i] as EscortPlayVo;
				var PicBox:MovieClip;
				var playItem:EscortPlay;
				var bol:Boolean = checkArr(playVo.name);
//				if(bol){
//					PicBox		=	_disListArray[i];
//					playItem	=	_disListArray[i]["playItem"];
//				} else {
//					PicBox		=	new MovieClip();
//					playItem	=	new EscortPlay();
//				}
				PicBox		=	new MovieClip();
				playItem	=	new EscortPlay();
//				if(bol == false){
					playItem.url				=	ResPath.SWF	+ "movemoneycar_" + playVo.escortType + ".swf";
					playItem.scaleX				=	playItem.scaleY	=	.5
					playItem.x					=	playItem.y	=	0
					PicBox["playItem"] = playItem;
					PicBox.addChild(playItem);
					
					PicBox.addEventListener(MouseEvent.CLICK, 		listPicClickHandle);
					PicBox.addEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
					PicBox.addEventListener(MouseEvent.MOUSE_MOVE,	listPicMoveHandle);
					PicBox.addEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
//				}
				PicBox.y					=	_imageYArray[(i%_imageYArray.length)];
//				PicBox.y					=	_imageYArray[i];
				PicBox.x					=	50 + ((1200-70) -(1200 -70)* (playVo.overTime / playVo.timeMax));
//				PicBox.y					=	351;
//				PicBox.x					=	569;
		//		trace("EscortSceneLogic.addPlayList(val)",PicBox.x,playVo.name)
				
				PicBox["speed"]			=	(1200-70) / playVo.timeMax;
				PicBox["data"]				=	playVo;
				PicBox["hero"]				=	0;
				
				if(_model.scene.Role.getPlayerName() == playVo.name)
				{
					PicBox["hero"]				=	1;
					PicBox.filters	=	[new GlowFilter(_colorGreed, .7, 10, 10 )]
//					PicBox.addEventListener(MouseEvent.CLICK, 		listPicClickHandle);
//					PicBox.addEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
//					PicBox.addEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
				}
//				else
//				{
//					PicBox.filters	=	[new GlowFilter(_colorGreed, .7, 10, 10 )]
//				}
				
//				if(bol == false){
					_myDis.palySpace.addChild(PicBox);
					_disListArray.push(PicBox);
//				}
			}
			_time.stop();
			_time.removeEventListener(TimerEvent.TIMER, timerHandle);
			_time.addEventListener(TimerEvent.TIMER, timerHandle);
			_time.start();
		}
		/**
		 * 加载完成 
		 * @param e
		 * 
		 */		
		private function completeHandle(e:DisplayObjectContainer):void
		{
			
		}
		/**
		 * 显示有关公保护的那个哥们的红色效果 
		 * @param name_
		 * @param addRome
		 * 
		 */		
		private function checkHeroFilt(name_:String,addRome:int):void
		{
			if(name_ == "")return;
			if(name_ == _addHeroName){
				addRome = 1;
			} else {
				addRome = -1;
			}
			var checkItem:EscortPlayVo;
			var checkMC:MovieClip
			for(var i:int; i < _disListArray.length; i++)
			{
				checkMC		=	_disListArray[i] as MovieClip
				checkItem	=	checkMC["data"];
				if(name_	==	checkItem.name)
				{
					if(addRome ==1)
					{
						if(checkItem.name != _model.scene.Role.getPlayerName())
						{
							checkMC.filters	=	[new GlowFilter(_colorRed, .7, 10, 10 )]
						}
						checkMC["hero"]	=	1;
						return;			
					}
					else if(addRome == 2)
					{
						if(checkItem.name == _model.scene.Role.getPlayerName())
						{
							checkMC.filters	=	[new GlowFilter(_colorGreed, .7, 10, 10 )]
						}
						else
						{
							checkMC.filters	=	null;
						}
						checkMC["hero"]	=	0;
						return;
					}
				}
			}
		}
		/**
		 * 设定运镖按钮是否可用 
		 * @param val
		 * 
		 */		
		private function setEscortEnable(isHave_:Boolean,isNumOver_:Boolean):void
		{
			if(isHave_)
			{
				_myDis.overTime.visible		=	true;
				_myDis.info_2.visible		=	false;
				if(_model.scene.Role.getVipLevel() >= _convoyObj["AccelerationVIPLevel"])
				{
					_myDis.OverBtn.visible			=	true;
				}
				else
				{
					_myDis.OverBtn.visible			=	false;
				}
//				_myDis.escortBtn.filters		=	[FilterUtil.GrayColorFilter];
//				_myDis.escortBtn.mouseEnabled	= _myDis.escortBtn.mouseChildren =	false;
				_myDis.escortBtn.enabled	=	false;
			}
			else
			{
				_myDis.overTime.visible		=	false;
				_myDis.OverBtn.visible		=	false;
				_myDis.info_2.visible		=	true;
				if(isNumOver_)
				{
//					_myDis.escortBtn.filters		=	[FilterUtil.GrayColorFilter];
//					_myDis.escortBtn.mouseEnabled	= _myDis.escortBtn.mouseChildren =	false;
					_myDis.escortBtn.enabled	=	false;
				}
				else
				{
//					_myDis.escortBtn.filters	=	null;
//					_myDis.escortBtn.mouseEnabled	=	true;
					_myDis.escortBtn.enabled	=	true;
				}
			}
		}
		/**
		 * 检测关公按钮是否可用 
		 * @param isHeroWork
		 * @param isVIPLevelOK
		 * 
		 */		
		private function setCheckHeroBtnEnable(isHeroWork:Boolean):void
		{
			if(_heroIsWork)
			{
//				_myDis.heroBtn.mouseEnabled	=	_myDis.heroBtn.mouseChildren	=	false;
//				_myDis.heroBtn.filters	=	[FilterUtil.GrayColorFilter];
				_myDis.heroBtn.enabled	=	false;
			}
			else
			{
//				_myDis.heroBtn.mouseEnabled	=	true;
//				_myDis.heroBtn.filters		=	null;
				_myDis.heroBtn.enabled	=	true;
			}
		}
		/**
		 * 刷新运镖队伍列表 
		 */		
		private function upDataPlayList():void
		{
			for(var i :int =0; i < _disListArray.length; i++)
			{
				var item:MovieClip	=	_disListArray[i] as MovieClip;
				(item["data"] as EscortPlayVo).overTime --;
//				item.x				+=	item["speed"];
				TweenLite.to(item, .5, {x:item.x + item["speed"]});
				if(item["data"].name == _model.scene.Role.getPlayerName()){
					//更新玩家押镖是否结束
					SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_UPDATE_SELF_CONVOY_INFO);
				}
				if(item.x >= 1280 - 104)
				{
					_disListArray.splice(i,1);
					item.removeEventListener(MouseEvent.CLICK, 		listPicClickHandle);
					item.removeEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
					item.removeEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
					item.parent.removeChild(item);
				}
			}
		}
		/**
		 * 清空队伍容器
		 */		
		private function clearPlay():void
		{
			for(var i:int = 0; i < _disListArray.length; i++)
			{
				var itemMC:MovieClip	=	_disListArray[i] as MovieClip;
				if(itemMC != null)
				{
					itemMC.removeEventListener(MouseEvent.CLICK, 		listPicClickHandle);
					itemMC.removeEventListener(MouseEvent.MOUSE_OVER,	listPicOverHandle);
					itemMC.removeEventListener(MouseEvent.MOUSE_OUT, 	listPicOutHandle);
					itemMC.parent.removeChild(itemMC);
					itemMC = null;
				}
			}
			_disListArray	=	[];
		}

		/**
		 * 点击事件 
		 * @param e
		 * 
		 */		
		private function btnClickHandle(e:MouseEvent):void
		{
			var target:DisplayObjectContainer	=	e.currentTarget as DisplayObjectContainer;
			switch(target)
			{
				case _myDis.closeBtn:
					_reftime.stop();
					_myDis.hide();
					break;
				case _myDis.escortBtn:
					EscortUI.getInstance().show();
					break;
				case _myDis.heroBtn:
					//召唤英雄
					SitAlerLogic.getIntatic().setUIinfo("		" + StaticIni.getSwfLangStr("UIString_1000529"), [], heroBtnHandler, _myDis.heroBtn);
					break;
				case _myDis.OverBtn:
					//立即完成
					var playerConvoyIndex : String = _model.scene.Role.GetPropertiesEx( "PlayerConvoyIndex" );
					var cost : String = StaticIni.getIniVar( "escortCost", playerConvoyIndex );
					SitAlerLogic.getIntatic().setUIinfo("				" + StaticIni.getSwfLangStrVar( "EscortStr_33", [ cost ] ) , [], overBtnHandler, _myDis.OverBtn);
					break;
				case _myDis.addTime:
					//清CD
					SitAlerLogic.getIntatic().setUIinfo("				" + StaticIni.getSwfLangStr("EscortStr_36"), [], addTimeHandler, _myDis.addTime);
					break;
			}
		}
		
		private function heroBtnHandler():void
		{
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_AFFIRM_CHARGE,6);
			_model.dispatchEvent(new SoundEvent(SoundEvent.ESCORT_CALL));
			LogSendLogic.getInstance().btnClickNumSend(22821);
		}
		
		private function overBtnHandler():void
		{
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_AFFIRM_CHARGE,8);
			LogSendLogic.getInstance().btnClickNumSend(22822);
		}
		
		private function addTimeHandler():void
		{
			SystemSender.getInstance().CustomMsgEx(CustomToServerFlag.CLEINT_CUSTOMMSG_REQUEST_CLEAR_CD,[7,_col]);
			LogSendLogic.getInstance().btnClickNumSend(22823);
		}
		/**
		 * 显示提示 
		 * @param val
		 * 
		 */		
		private function btnOverHandle(e:MouseEvent):void
		{
			var target:DisplayObjectContainer	=	e.currentTarget as DisplayObjectContainer;
			switch(target)
			{
				case _myDis.heroBtn:
					//召唤英雄
					TipsMainLogic.instance.showString(StaticIni.getSwfLangStrVar("EscortStr_19",[2500 *( _playerConvoyCallCount +1),_convoyObj["maxNum"]-_playerConvoyCallCount]))
					break;
				case _myDis.OverBtn:
					//根据押镖的等级显示不同的价格
					var playerConvoyIndex : String = _model.scene.Role.GetPropertiesEx( "PlayerConvoyIndex" );
					var cost : String = StaticIni.getIniVar( "escortCost", playerConvoyIndex );
					TipsMainLogic.instance.showString( StaticIni.getSwfLangStrVar( "EscortStr_33", [ cost ] ) );
					break;
				case _myDis.addTime:
					TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("EscortStr_36"));
					//立即完成
					break;
				case _myDis.logoPic:
					//武神关羽	如果是自己，则显示不一样拉
					if(_addHeroName == "") return;
					if(_model.scene.Role.getPlayerName() == _addHeroName){
						TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("UIString_1000530"));
					} else {
						TipsMainLogic.instance.showString(StaticIni.getSwfLangStrVar("UIString_1000531", [_addHeroName]));
					}
					break;
				case _myDis.moneyText_1:
					//元宝
					TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("MagicCoin") + "：" + _magicCoin);
					break;
				case _myDis.moneyText_2:
					//铜钱
					TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("GoldCoin") + "：" + _goldCoin);
					break;
				case _myDis.activePic:
					if(coveryActive != -1)
					{
						TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("EscortStr_38"));
					} 
					break;
				case _myDis.springFestivalPic:
					TipsMainLogic.instance.showString(StaticIni.getSwfLangStr("EscortStr_39"));
					break;
			}
		}
		/**
		 * 关闭显示 
		 * @param e
		 * 
		 */		
		private function btnOutHandle(e:MouseEvent):void
		{
			TipsMainLogic.instance.hide();
		}
		/**
		 * 队伍点击事件 
		 * @param e
		 * 
		 */		
		private function listPicClickHandle(e:MouseEvent):void
		{
			var item:MovieClip		=	e.currentTarget as MovieClip;
			var playVo:EscortPlayVo	=	item["data"] as EscortPlayVo;
			if(!_isCanPK)
			{
				NoticeUI.getInstance().showInfo(StaticIni.getSwfLangStr("UIString_1000532"));
				return;
			}

			if(_isCDTimer)
			{
				NoticeUI.getInstance().showInfo(StaticIni.getSwfLangStr("EscortStr_34"));
				return;
			}
			if(playVo.name != _model.scene.Role.getPlayerName() && playVo.helpName != _model.scene.Role.getPlayerName())
			{
				if(item["hero"] == 1)
				{
					NoticeUI.getInstance().showInfo(StaticIni.getSwfLangStr("EscortStr_32"));
				}
				else
				{
					if(playVo.index >= 2)
					{
						NoticeUI.getInstance().showInfo(StaticIni.getSwfLangStr("UIString_1000533"));
					}
					else
					{
						AlertUI.showAlert("",StaticIni.getSwfLangStrVar("UIString_1000534", [playVo.name, 
											StaticIni.getSwfLangStr("EscortName_0" + playVo.escortType)]),AlertUI.YES|AlertUI.NO,alertClickHandle,[playVo.name]);
					}
				}				
			}
		}
		/**
		 * 提示确认
		 */		
		private function alertClickHandle(type:int, str:String, clickData:* ):void
		{
			if(type == AlertUI.YES)
			{
				SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_AFFIREM_ROB_CONVOY,new WString(clickData[0]));
			}
			if(_pic.visible){
				Mouse.show();
				_pic.visible = false;
				_pic.stop();
				StageInfo.stage.removeChild(_pic);
				TipsMainLogic.instance.hide();
			}
		}
		/**
		 * 请求你的帮助确认提示
		 * @param type
		 * @param str
		 * @param clickData
		 * 
		 */		
		private function requestHelpHandle(type:int, str:String, clickData:* ):void
		{
			if(type == AlertUI.YES)
			{
				SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_AFFIREM_HELP_CONVOY,new WString(clickData[0]),1);
			}else if (type == AlertUI.NO)
			{
				SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_AFFIREM_HELP_CONVOY,new WString(clickData[0]),2);
			}
		}
		
		/**
		 * 查看信息 
		 * @param e
		 * 
		 */	
		private function listPicOverHandle(e:MouseEvent):void
		{
			var item:MovieClip		=	e.currentTarget as MovieClip;
			var playVo:EscortPlayVo	=	item["data"] as EscortPlayVo;
			
			if(item["hero"] == 0)
			{
				item.filters	=	[FilterUtil.WhiteGlowFilter];
			}
			if(playVo != null)
			{
				var shouyi:String = "";
				if(playVo.name == _model.scene.Role.getPlayerName()){
					if(_playerGold != 0 && _playerRepute != 0){
						shouyi = StaticIni.getSwfLangStrVar("EscortStr_37",[_playerGold,_playerRepute]);
					}
				} else {
					shouyi = playVo.index >=2?StaticIni.getSwfLangStr("UIString_1000535"):StaticIni.getSwfLangStrVar("EscortStr_8",[playVo.escortMoney,playVo.reputation]);
				}
				var str:String	=	StaticIni.getSwfLangStrVar("EscortStr_11",[
					playVo.name,
					playVo.level,
					playVo.clanName ==""?StaticIni.getSwfLangStr("Common_Null"):playVo.clanName,
					StaticIni.getSwfLangStr("EscortName_0" + playVo.escortType),
					playVo.index,
					2,
					Math.floor(playVo.overTime/60),
					playVo.overTime%60,
					playVo.helpName==""?StaticIni.getSwfLangStr("Common_Null"):playVo.helpName,
					shouyi
				])
				TipsMainLogic.instance.showString(str);
			}
			
			if(playVo.name == _model.scene.Role.getPlayerName()) return;
			if(playVo.helpName == _model.scene.Role.getPlayerName()) return;
			
			Mouse.hide();
			_pic.visible = true;
			_pic.play();
			_pic.mouseEnabled	=	_pic.mouseChildren	=	false;
			StageInfo.stage.addChild(_pic);
			_pic.x = StageInfo.stage.mouseX - _pic.width;
			_pic.y = StageInfo.stage.mouseY - _pic.height;
		}
		/**
		 * 隐藏信息 
		 * @param e
		 * 
		 */		
		private function listPicOutHandle(e:MouseEvent):void
		{
			var item:MovieClip		=	e.currentTarget as MovieClip;
			var playVo:EscortPlayVo	=	item["data"] as EscortPlayVo;
			TipsMainLogic.instance.hide();
			if(item["hero"] == 0)
			{
				item.filters	=	null;
			}
			
			if(playVo.name == _model.scene.Role.getPlayerName()) return;
			if(playVo.helpName == _model.scene.Role.getPlayerName()) return;
			Mouse.show();
			_pic.visible = false;
			_pic.stop();
			StageInfo.stage.removeChild(_pic);
		}
		
		/**
		 * 鼠标移动
		 */
		private function listPicMoveHandle(e:MouseEvent):void
		{
			_pic.x = StageInfo.stage.mouseX;
			_pic.y = StageInfo.stage.mouseY;
//			e.updateAfterEvent();
		}
		
		/**
		 * 计时触发 
		 * @param e
		 */		
		private function timerHandle(e:TimerEvent):void
		{
			upDataPlayList();
			showMoveTime()
		}
		/**
		 * 180秒刷新
		 */
		private function reftimerHandle(e:TimerEvent):void
		{
			SystemSender.getInstance().CustomMsg(CustomToServerFlag.CLIENT_CUSTOMMSG_CONVOY_OPEN_UI);
		}
		/**
		 * 英雄帮助时间 
		 * @param e
		 * 
		 */		
		private function heroTimerHandle(e:TimerEvent):void
		{
//			_myDis.logoPic.gotoAndStop(60 - _overTimer);
			_overTimer--;
			var _leftTime:Array = getOverTime(_overTimer);
			var min:String = _leftTime[0];
			var sec:String = _leftTime[1];
			_myDis.leftTimeLabel.htmlText = StaticIni.getSwfLangStrVar("UIString_1000536", [min, sec]);
			if(_overTimer <= 0)
			{
				_heroIsWork					=	false;
				_myDis.logoPic.visible		=	false;
				_myDis.leftTimeLabel.visible =  false;
				_heroTimer.stop();
			}
			else
			{
				_heroIsWork					=	true;
				_myDis.logoPic.visible		=	true;
				_myDis.leftTimeLabel.visible =  true;
			}
			setCheckHeroBtnEnable(_heroIsWork);
			
		}
		
		/**
		 * 获得剩余时间显示格式
		 */
		private function getOverTime(val:int):Array
		{
			var min:int = 0;
			var sec:int = 0;
			var arr:Array = new Array();
			min = Math.floor(val / 60);
			sec = val - min * 60;
			if(min >= 10 && sec >= 10){
				arr.push(min, sec);
			} else if (min >= 10 && sec < 10){
				arr.push(min, "0" + sec);// = min + "分0" + sec + "秒";
			} else if (min < 10 && sec >= 10){
				arr.push("0" + min, sec);// = "0" + min + "分" + sec + "秒";
			} else {
				arr.push("0" + min, "0" + sec);// = "0" + min + "分0" + sec + "秒";
			}
			return arr;
		}
		
		private function showMoveTime():void
		{
			if(_moveTime > 0)
			{
				_myDis.overTime.htmlStrByBorder	=	StaticIni.getSwfLangStr("UIString_1000537") + PlayCDTimerLogic.getInstance().getTimerStr(_moveTime);
				_moveTime--;
			}
			else
			{
				_myDis.overTime.htmlStrByBorder	=	"";
			}
		}

		/**
		 *是否有武神的存在 
		 * @return 
		 * 
		 */		
		public function get addRoRemove():int
		{
			return _addRoRemove;
		}
		
		/**
		 *有没有活动在 
		 * @return 
		 * 1：万里 2：天下
		 */		
		public function get coveryActive():int
		{
			return _coveryActive;
		}
		
		/**
		 *春节活动是否开启 
		 * @return 
		 * 
		 */		
		public function get springFestival():Boolean
		{
			return _springFestival;
		}
		
		/**
		 *解析押镖活动 
		 * @param val
		 * 状态，剩余时间
		 */		
		private function dealActiveInfo(val:Array):void
		{
			//只要有活动，活动参数就不为-1；
			if(val[1] == 0){
				_coveryActive = -1;
				_myDis.activePic.visible = false;
				_myDis.activeLeftTime.visible = false;
			} else {
				_coveryActive = val[1];
				_myDis.activePic.visible = true;
				_myDis.activeLeftTime.visible = true;
				
				if(_activeTimer){
					_activeTimer.stop();
					_activeTimer.removeEventListener(TimerEvent.TIMER,	activeTimerHandler);
				}
				
				_activeOverTimer	=	val[2];
				_activeTimer	=	new Timer(1000, _activeOverTimer);
				_activeTimer.addEventListener(TimerEvent.TIMER,	activeTimerHandler);
				_activeTimer.start();
				activeTimerHandler(null)
				
				//万里
				if(_coveryActive == 1){
					_myDis.activePic.gotoAndStop(1);
				} else {
					_myDis.activePic.gotoAndStop(2);
				}
			}
		}
		
		private function activeTimerHandler(t:TimerEvent):void
		{
			_activeOverTimer--;
			var _leftTime:Array = getOverTime(_activeOverTimer);
			var min:String = _leftTime[0];
			var sec:String = _leftTime[1];
			_myDis.activeLeftTime.htmlText = StaticIni.getSwfLangStrVar("UIString_1000536", [min, sec]);
			if(_activeOverTimer <= 0)
			{
				_myDis.activePic.visible		= false;
				_myDis.activeLeftTime.visible	= false;
				_activeTimer.stop();
			}
			else
			{
				_myDis.activePic.visible		= true;
				_myDis.activeLeftTime.visible 	= true;
			}
		}
		
		private function dealSpringFestival(val:Array):void
		{
			_springFestival = true;
			_myDis.springFestivalPic.visible	= true;
			_myDis.springFestivalLab.visible	= true;
		}

	}
}